package com.zds.support.util


object FastClickUtils {
    private var lastClickTime = 0L
    private val MIN_DELAY_TIME = 0.3 * 1000

    @JvmStatic
    fun isFastClick(): Boolean {
        var flag = true
        val currentClickTime = System.currentTimeMillis()
//        LogUtils.d("currentClickTime:${currentClickTime}-lastClickTime:${lastClickTime} === ${Math.abs(currentClickTime - lastClickTime)} || ${Math.abs(currentClickTime - lastClickTime) > MIN_DELAY_TIME}")
        if (Math.abs(currentClickTime - lastClickTime) > MIN_DELAY_TIME) {
            flag = false
        } else {
        }
        lastClickTime = currentClickTime
        return flag
    }

    @JvmStatic
    fun isLongFastClick(delayTime:Int): Boolean {
        var flag = true
        val currentClickTime = System.currentTimeMillis()
//        LogUtils.d("currentClickTime:${currentClickTime}-lastClickTime:${lastClickTime} === ${Math.abs(currentClickTime - lastClickTime)} || ${Math.abs(currentClickTime - lastClickTime) > MIN_DELAY_TIME}")
        if (Math.abs(currentClickTime - lastClickTime) > delayTime) {
            flag = false
        } else {
        }
        lastClickTime = currentClickTime
        return flag
    }
}